package com.idata.model.proxyDO;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.idata.model.utils.DefaultImgUrlManager;
import com.idata.model.utils.ImgReplaceUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class KGCitizenDO {
    private PeopleProperties people;
    private TagProperties tag;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class PeopleProperties {
        @JsonProperty("人物.姓名")
        private String name;

        @JsonProperty("人物.身份证号码")
        private String idCard;

        @JsonProperty("人物.户籍地址")
        private String registeredResidenceAddress;

        @JsonProperty("人物.现住址")
        private String currentAddress;

        private String avatarUrl;

        public String getAvatarUrl() {
            if (StrUtil.isNotEmpty(avatarUrl)) {
                return ImgReplaceUtils.replaceHost(avatarUrl);
            }
            return DefaultImgUrlManager.DEFAULT_AVATAR_IMG_URL;
        }
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class TagProperties {
        @JsonProperty("标签_年龄.META_NAME")
        private Integer age;

        @JsonProperty("标签_民族.META_NAME")
        private String nation;

        @JsonProperty("标签_文化程度.META_NAME")
        private String education;

        @JsonProperty("标签_籍贯.META_NAME")
        private String nativePlace;

        @JsonProperty("标签_性别.META_NAME")
        private String gender;
    }

}

